/**
 * 
 */
package uk.ac.ebi.curtain.utils.io.impl;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import uk.ac.ebi.curtain.utils.io.AbstractIO;

/**
 * @author mhaimel
 *
 */
public class ClasspathIO extends AbstractIO{

	private String classPath;

	/**
	 * 
	 */
	public ClasspathIO(String classPath) {
		this.classPath = classPath;
	}

	@Override
	protected InputStream getBaseInputStream() throws IOException {
		return this.getClass().getResourceAsStream(getClassPath());
	}

	private String getClassPath() {
		return classPath;
	}

	@Override
	protected OutputStream getBaseOutputStream() throws IOException {
		throw new UnsupportedOperationException(
				"Not able to write to classpath resource: " + getClassPath());
	}

	@Override
	protected CompressionFormat[] getStreamCompression() {
		return new CompressionFormat[0];
	}

}
